package chixing.day05;

/**
 * 3. 在ProductTest中 实例化5个商品添加到数组Product[] 中，并遍历输出商品的id与名称,价格
 * 4. 输出显示商品价格超过300的商品的名称
 */
public class ProductTest {
    public static void main(String[] args) {
        Product product1 = new Product(1,"电脑",4856,"笔记本电脑");
        Product product2 = new Product(2,"手机",2344,"小米手机");
        Product product3 = new Product(3,"手表",46,"小米手表");
        Product product4 = new Product(4,"显示器",6587,"显示器");
        Product product5 = new Product(5,"键盘",54,"机械键盘");

        Product[] arrayProduct1 = {product1,product2,product3,product4,product5};

        for (int i = 0;i < arrayProduct1.length;i++){
            if (arrayProduct1[i].getProductPrice() > 300 )
                System.out.println(arrayProduct1[i].getProductId() + ";" + arrayProduct1[i].getProductName() + ";"
                        + arrayProduct1[i].getProductPrice() );
        }

    }
}
